/*
 * @version: vue3
 * @Author: lxs
 * @Date: 2022-04-30 19:06:04
 * @LastEditors: sueRimn
 * @LastEditTime: 2022-04-30 19:12:37
 */
import { ITab } from "../type/index";
// 定义state
export interface TabsState {
  tabsList: Array<ITab>;
}
export const state: TabsState = {
  tabsList: [],
};
export const mutations = {
  addTabs: (state: TabsState, tab: ITab) => {
    if (state.tabsList.some((item) => item.path === tab.path)) return;
    state.tabsList.push(tab);
  },
};
export const actions = {};
export const getters = {
  getTabsList: (state: TabsState) => {
    return state.tabsList;
  },
};
export default {
  namespace: true,
  state,
  mutations,
  actions,
  getters,
};
